<template>
  <div class="app-container">
    <el-row class="marginBottom20">
      <el-col :span="12">
        <h4 class="title">财政数据</h4>
        <div class="bgF9 padding20">
          <el-form ref="form" :model="financeImportData" :rules="rules" label-width="140px" class="compareForm">
            <el-form-item prop="reportNo" label="报告文号">
              <el-input v-model="financeImportData.reportNo" type="text" placeholder="请输入事务所名称" disabled/>
            </el-form-item>
            <!-- <el-form-item prop="antiCounterfeitingCoding" label="防伪编码">
              <el-input v-model="financeImportData.antiCounterfeitingCoding" type="text" placeholder="请输入防伪编码" disabled/>
            </el-form-item> -->
            <el-form-item prop="customerName" label="客户名称（被审验单位名称）">
              <el-input v-model.trim="financeImportData.customerName" type="text"  placeholder="请输入客户名称（被审验单位名称）" disabled/>
            </el-form-item>
            <el-form-item prop="customerBusinessLicense" label="客户营业执照号">
              <el-input v-model="financeImportData.customerBusinessLicense" type="text" placeholder="请输入客户营业执照号" disabled/>
            </el-form-item>
            <!-- <el-form-item prop="firmName" label="事务所名称">
              <el-input v-model="financeImportData.firmName" type="text"  placeholder="请输入事务所名称" disabled/>
            </el-form-item> -->
            <!-- <el-form-item prop="administrativeDivision" label="事务所行政区划">
              <el-input v-model="financeImportData.administrativeDivision" type="text" placeholder="请输入事务所行政区划" disabled/>
            </el-form-item> -->
            <!-- <el-form-item prop="hasSecurities" label="是否具有证券资格">
              <el-select v-model="financeImportData.hasSecurities" placeholder="请选择" disabled>
                <el-option label="是" value="是" />
                <el-option label="否" value="否" />
              </el-select>
            </el-form-item> -->
            <el-form-item prop="isSecuritiesBusiness" label="是否属于证券业务">
              <el-select v-model="financeImportData.isSecuritiesBusiness" placeholder="请选择" disabled>
                <el-option label="是" value="是" />
                <el-option label="否" value="否" />
              </el-select>
            </el-form-item>
            <el-form-item prop="firstBusinessTime" label="首次承接业务时间">
              <el-date-picker
                v-model="financeImportData.firstBusinessTime"
                type="date"
                placeholder="请选择" disabled>
              </el-date-picker>
            </el-form-item>
            <el-form-item prop="officeRemarks" label="备注">
              <el-input v-model="financeImportData.officeRemarks" type="text"  placeholder="请输入备注" disabled/>
            </el-form-item>
            <el-form-item prop="opinionType" label="意见类型">
              <el-select v-model="financeImportData.opinionType" placeholder="请选择" class="widthMax" disabled
                         clearable
                         filterable
              >
                <el-option
                  v-for="(item,index) in opinionTypeOption"
                  :key="index+'o1'"
                  :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </el-form-item>
            <el-form-item prop="reportTime" label="报告日期">
              <el-date-picker
                v-model="financeImportData.reportTime"
                type="date"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                placeholder="请输入报告日期" disabled>
              </el-date-picker>
            </el-form-item>
            <!-- <el-form-item prop="reportCode" label="报备编码">
              <el-input v-model="financeImportData.reportCode" type="text"  placeholder="请输入报备编码" disabled/>
            </el-form-item> -->
            <el-form-item prop="reportType" label="报备类型">
              <el-select v-model="financeImportData.reportType" placeholder="请选择" disabled
              >
                <el-option
                  v-for="(item,index) in reportTypeOption"
                  :key="index+'r1'"
                  :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </el-form-item>
            <!-- <el-form-item prop="filingYear" label="报备年度" >
              <el-date-picker
                v-model="financeImportData.filingYear"
                type="year"
                placeholder="请选择" disabled>
              </el-date-picker>
            </el-form-item> -->
            <!-- <el-form-item prop="filingTime" label="报备日期">
              <el-date-picker
                v-model="financeImportData.filingTime"
                type="date"
                placeholder="请选择" disabled>
              </el-date-picker>
            </el-form-item> -->
            <!-- <el-form-item prop="reportStatus" label="报备状态">
              <el-select v-model="financeImportData.reportStatus" placeholder="请选择" disabled>
                <el-option label="已报备" value="已报备" />
                <el-option label="未报备" value="未报备" />
              </el-select>
            </el-form-item> -->
            <el-form-item prop="auditYear" label="审计年度" >
              <!--<el-date-picker
                v-model="financeImportData.auditYear"
                type="year"
                format="yyyy"
                value-format="yyyy"
                placeholder="请选择" disabled>
              </el-date-picker>-->
              <el-input v-model="financeImportData.auditYear" type="text" disabled />
            </el-form-item>
            <!-- <el-form-item prop="uploadTime" label="上传时间">
              <el-date-picker
                v-model="financeImportData.uploadTime"
                type="datetime"
                placeholder="请选择" disabled>
              </el-date-picker>
            </el-form-item> -->
            <el-form-item prop="chargeAmount" label="收费金额（元）">
              <el-input v-model="financeImportData.chargeAmount" type="text"  placeholder="请输入收费金额" disabled/>
            </el-form-item>
          <!--  <el-form-item prop="capitalVerificationAmount" label="验资金额（元）">
              <el-input v-model="financeImportData.capitalVerificationAmount" type="text"  placeholder="请输入验资金额" disabled/>
            </el-form-item>
            <el-form-item prop="capitalVerificationCurrency" label="验资币种">
              <el-select
                v-model="financeImportData.capitalVerificationCurrency"
                placeholder="请选择"
                disable
              >
                <el-option
                  v-for="(item,index) in currencyTypeOption"
                  :key="index+'c1'"
                  :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </el-form-item>-->
            <div v-for="(item, index) in financeImportData.assuranceBusinessDataRegisterSignatures" :key="item.registerId">
              <el-form-item
                :label="`签字注会${index+1}证书号`"
                :prop="'assuranceBusinessDataRegisterSignatures.' + index + '.registrationCertificateNo'"
                :rules="validateNo"
              >
                <el-input v-model="item.registrationCertificateNo" type="text"  placeholder="请输入签字注师证号" disabled/>
              </el-form-item>
              <el-form-item
                :label="`签字注册会计师${index+1}`"
                :prop="'assuranceBusinessDataRegisterSignatures.' + index + '.registrantName'"
                :rules="validateName"
              >
                <el-input v-model="item.registrantName" type="text"  placeholder="请输入签字注师姓名" disabled/>
              </el-form-item>
            </div>
          </el-form>
        </div>
      </el-col>
      <el-col :span="12">
        <h4 class="title">事务所防伪系统录入数据</h4>
        <div class="padding20">
          <el-form ref="form" :model="officeInputData" :rules="rules" label-width="150px" class="compareForm">
            <el-form-item prop="reportNo" label="报告文号">
              <el-input v-model="officeInputData.reportNo" ref="input" type="text" placeholder="请输入事务所名称" @focus="handleCompare" @input="handleCompare" :disabled="accountDisabled"/>
            </el-form-item>
            <!-- <el-form-item prop="antiCounterfeitingCoding" label="防伪编码">
              <el-input v-model="officeInputData.antiCounterfeitingCoding" type="text" :disabled="accountDisabled" placeholder="请输入防伪编码"/>
            </el-form-item> -->
            <el-form-item prop="customerName" label="客户名称（被审验单位名称）">
              <el-input v-model.trim="officeInputData.customerName" type="text" placeholder="请输入客户名称（被审验单位名称）" @focus="handleCompare" @input="handleCompare" @change="handleCompare" :disabled="accountDisabled"/>
            </el-form-item>
            <el-form-item prop="customerBusinessLicense" label="客户营业执照号">
              <el-input v-model="officeInputData.customerBusinessLicense" type="text" placeholder="请输入客户营业执照号" @focus="handleCompare" @input="handleCompare" :disabled="accountDisabled"/>
            </el-form-item>
            <!-- <el-form-item prop="firmName" label="事务所名称">
              <el-input v-model="officeInputData.firmName" type="text"  placeholder="请输入事务所名称" @focus="handleCompare" @input="handleCompare" :disabled="accountDisabled"/>
            </el-form-item> -->
            <!-- <el-form-item prop="administrativeDivision" label="事务所行政区划">
              <el-input v-model="officeInputData.administrativeDivision" type="text" placeholder="请输入事务所行政区划" @focus="handleCompare" @input="handleCompare" @change="handleCompare" :disabled="accountDisabled"/>
            </el-form-item> -->
            <!-- <el-form-item prop="hasSecurities" label="是否具有证券资格">
              <el-select v-model="officeInputData.hasSecurities" placeholder="请选择" @focus="handleCompare" @input="handleCompare" :disabled="accountDisabled">
                <el-option label="是" value="是" />
                <el-option label="否" value="否" />
              </el-select>
            </el-form-item> -->
            <el-form-item prop="isSecuritiesBusiness" label="是否属于证券业务">
              <el-select v-model="officeInputData.isSecuritiesBusiness" placeholder="请选择" @focus="handleCompare"  :disabled="accountDisabled" @input="handleCompare">
                <el-option label="是" value="是" />
                <el-option label="否" value="否" />
              </el-select>
            </el-form-item>
            <el-form-item prop="firstBusinessTime" label="首次承接业务时间">
              <el-date-picker
                v-model="officeInputData.firstBusinessTime"
                type="date"
                value-format="yyyy-MM-dd" format="yyyy-MM-dd"
                placeholder="请选择" :disabled="accountDisabled" @blur="handleCompare">
              </el-date-picker>
            </el-form-item>
            <el-form-item prop="officeRemarks" label="备注">
              <el-input v-model="officeInputData.officeRemarks" type="text"  placeholder="请输入备注" :disabled="accountDisabled"/>
            </el-form-item>
            <el-form-item prop="opinionType" label="意见类型(可填可选)">
              <el-select v-model="officeInputData.opinionType" placeholder="请选择" class="widthMax"
                         @focus="handleCompare"
                         @input="handleCompare"
                         clearable
                         filterable
                         :disabled="accountDisabled"
                         @blur="selectBlur"
              >
                <el-option
                  v-for="(item,index) in opinionTypeOption"
                  :key="index+'o2'"
                  :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </el-form-item>
            <el-form-item prop="reportTime" label="报告日期" >
              <el-date-picker
                v-model="officeInputData.reportTime"
                :disabled="accountDisabled"
                type="date"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                placeholder="请输入报告日期" @blur="handleCompare" @change="handleCompare">
              </el-date-picker>
            </el-form-item>
            <!-- <el-form-item prop="reportCode" label="报备编码">
              <el-input v-model="officeInputData.reportCode" type="text"  placeholder="请输入报备编码"  :disabled="accountDisabled" @focus="handleCompare" @input="handleCompare"/>
            </el-form-item> -->
            <el-form-item prop="reportType" label="报备类型">
              <el-select v-model="officeInputData.reportType"
                         placeholder="请选择"
                         @focus="handleCompare"
                         @input="handleCompare"
                         :disabled="accountDisabled"
                         clearable
                         filterable
              >
                <el-option
                  v-for="(item,index) in reportTypeOption"
                  :key="index+'r2'"
                  :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </el-form-item>
            <!-- <el-form-item prop="filingYear" label="报备年度">
              <el-date-picker
                v-model="officeInputData.filingYear"
                :disabled="accountDisabled"
                type="year"
                placeholder="请选择">
              </el-date-picker>
            </el-form-item> -->
            <!-- <el-form-item prop="filingTime" label="报备日期">
              <el-date-picker
                v-model="officeInputData.filingTime"
                :disabled="accountDisabled"
                type="date"
                placeholder="请选择">
              </el-date-picker>
            </el-form-item> -->
            <!-- <el-form-item prop="reportStatus" label="报备状态">
              <el-select v-model="officeInputData.reportStatus" placeholder="请选择"  :disabled="accountDisabled">
                <el-option label="已报备" value="已报备" />
                <el-option label="未报备" value="未报备" />
              </el-select>
            </el-form-item> -->
            <el-form-item prop="auditYear" label="审计年度" >
              <!--<el-date-picker
                v-model="officeInputData.auditYear"
                type="year"
                :disabled="accountDisabled"
                format="yyyy"
                value-format="yyyy"
                placeholder="请选择"
                @blur="handleCompare" @change="handleCompare"
              >
              </el-date-picker>-->
              <el-input v-model="officeInputData.auditYear"    :disabled="accountDisabled" type="text" />
            </el-form-item>
            <!-- <el-form-item prop="uploadTime" label="上传时间">
              <el-date-picker
                v-model="officeInputData.uploadTime"
                :disabled="accountDisabled"
                type="datetime"
                placeholder="请选择"
              >
              </el-date-picker>
            </el-form-item> -->
            <el-form-item prop="chargeAmount" label="收费金额（元）">
              <el-input v-model="officeInputData.chargeAmount" type="text"  placeholder="请输入收费金额"  :disabled="accountDisabled" @focus="handleCompare" @input="handleCompare"/>
            </el-form-item>
          <!--  <el-form-item prop="capitalVerificationAmount" label="验资金额（元）" >
              <el-input v-model="officeInputData.capitalVerificationAmount" type="text"  :disabled="accountDisabled"  placeholder="请输入验资金额" />
            </el-form-item>

            <el-form-item prop="capitalVerificationCurrency" label="验资币种">
              <el-select
                v-model="officeInputData.capitalVerificationCurrency"
                placeholder="请选择"
                clearable
                :disabled="accountDisabled"
                filterable
              >
                <el-option
                  v-for="(item,index) in currencyTypeOption"
                  :key="index+'c2'"
                  :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </el-form-item>-->

            <div v-for="(item, index) in officeInputData.assuranceBusinessDataRegisterSignatures" :key="item.registerId">
              <el-form-item
                :label="`签字注会${index+1}证书号`"
                :prop="'assuranceBusinessDataRegisterSignatures.' + index + '.registrationCertificateNo'"
                :rules="validateNo"
              >
                <el-input v-model="item.registrationCertificateNo" type="text"  placeholder="请输入签字注师证号" @focus="handleCompare"  :disabled="accountDisabled" @input="handleCompare"/>
              </el-form-item>
              <el-form-item
                :label="`签字注册会计师${index+1}`"
                :prop="'assuranceBusinessDataRegisterSignatures.' + index + '.registrantName'"
                :rules="validateName"
              >
                <el-input v-model="item.registrantName" type="text"  placeholder="请输入签字注师姓名" @focus="handleCompare" @input="handleCompare"  :disabled="accountDisabled"/>
              </el-form-item>
            </div>
          </el-form>
        </div>
      </el-col>
    </el-row>
    <div class="submitBtnGroup">
      <el-button
        size="medium"
        type="primary"
        v-judgeAccount="1"
        v-hasPermi="['assurance:apply:return']"
        @click.native.prevent="handleOpenReturn"
      >
        申请财政数据退回
      </el-button>
      <el-button
        size="medium"
        type="primary"
        :disabled="saveDisabled"
        @click.native.prevent="handleSaveOfficeInputData"
      >
        保存
      </el-button>
      <el-button
        size="medium"
        type="default"
        @click.native.prevent="handleClosePage"
      >
        <span>返 回</span>
      </el-button>
    </div>
    <!--    审批-->
    <el-dialog
      title="申请退回"
      :visible.sync="returnVisible"
      width="360px"
      :close-on-click-modal="false"
      append-to-body
      center
    >
      <el-input type="textarea" v-model="returnForm.reason" :rows="8" placeholder="请输入退回理由" />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleSubmitReturn">确 定</el-button>
        <el-button @click="handleCancelReturn">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import store from '@/store'
  import {editAssurance, putReturn,getCompareData} from "@/api/system/assurance";
  export default {
    name: "AssuranceCompare",
    data() {
      let checkNo = (rule, value, callback) => {
        let index = rule.field.split("assuranceBusinessDataRegisterSignatures.")[1].slice(0,1) // 通过rule 获取当前的index
        let labelFor = 'assuranceBusinessDataRegisterSignatures.' + index +'.registrationCertificateNo'
        let elementNo = $("label[for='"+labelFor+"']").parent('.el-form-item') // 通过label给父元素加标记
        if(this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo === this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo){
          elementNo.removeClass('compareMark')  // 相等 去掉标红
        }else{
          elementNo.addClass('compareMark') // 标红样式
          return callback(new Error('两边数据不一致'));
        }
        callback();
      };
      let checkName = (rule, value, callback) => {
        let index = rule.field.split("assuranceBusinessDataRegisterSignatures.")[1].slice(0,1) // 通过rule 获取当前的index
        let labelFor = 'assuranceBusinessDataRegisterSignatures.' + index +'.registrantName'
        let elementName = $("label[for='"+labelFor+"']").parent('.el-form-item') // 通过label给父元素加标记
        if(this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrantName === this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrantName){
          elementName.removeClass('compareMark')  // 相等 去掉标红
        }else{
          elementName.addClass('compareMark') // 标红样式
          return callback(new Error('两边数据不一致'));
        }
        callback();
      };
      return {
        businessId: this.$route.query.businessId,
        returnVisible: false,
        returnForm:{},
        saveDisabled: true, // 默认保存 不可点
        accountDisabled: false,
        financeImportData: {}, // 表单数据：财政系统导入
        officeInputData: {}, // 表单数据：事务所录入
        resultData: {}, // 对象：比对结果
        resultNoData: '', // 对象：比对结果 签字证书
        reportTypeOption: [], // 报备类型
        currencyTypeOption: [], // 验资币种
        opinionTypeOption: [], // 意见类型
        // 需要比对的字段列表: 只比对 必填项
        compareFields: ["customerBusinessLicense","firstBusinessTime","customerName", "reportType",
          "reportNo", "chargeAmount", "isSecuritiesBusiness","opinionType","reportTime"],
        rules: {
          firmName: [{ min: 3, max: 100, message: '长度在 3 到 100 个字符', trigger: 'blur' }],
          administrativeDivision: [{ trigger: "change", message: "事务所行政区划不能为空" }], // 事务所行政区划 200
          hasSecurities: [{ trigger: "change", message: "是否具有证券资格不能为空" }], // 是否具有证券资格 5
          customerName: [{ trigger: "change", message: "客户名称（被审验单位名称）不能为空" }], // 客户名称（被审验单位名称） 100
          customerBusinessLicense: [{ trigger: "change", message: "客户营业执照不能为空" }], // 客户营业执照 100
          reportType: [{ trigger: "change", message: "报备类型不能为空" }], // 报备类型 50
          auditYear: [{ trigger: "blur", message: "审计年度不能为空" }], // 审计年度 20
          reportNo: [{ trigger: "blur", message: "报告文号不能为空" }], // 报告文号 50
          chargeAmount: [{ trigger: "change", message: "收费金额不能为空" }], // 收费金额 20
          isSecuritiesBusiness: [{ trigger: "blur", message: "是否属于证券业务不能为空" }], // 是否属于证券业务 5
          opinionType: [{ trigger: "blur", message: "意见类型不能为空" }], // 意见类型 10
          reportTime: [{ trigger: "blur", message: "报告日期不能为空" }], // 报告日期 20
        },
        validateNo:[
          {required: true, message: '签字注师证号不能为空', trigger: 'blur'},
          { message: '两边数据不一致', validator: checkNo, trigger: 'blur' }
        ],
        validateName:[
          {required: true, message: '签字注师姓名不能为空', trigger: 'blur'},
          { message: '两边数据不一致', validator: checkName, trigger: 'blur' }
        ],
      };
    },
    created(){
      if(this.businessId){
        this.getData(this.businessId);
      }
    },
    mounted() {
      const userInfo = store.getters && store.getters.userInfo
      let isOfficeAccount = userInfo.isOfficeAccount;
      if(isOfficeAccount === 0){
        this.accountDisabled = true  // 权限
      }
      this.getDicts("report_type").then(response => {
        // 报备类型
        this.reportTypeOption = response.data;
      });
      this.getDicts("currency").then(response => {
        // 验资币种
        this.currencyTypeOption = response.data
      });
      this.getDicts("type_of_opinion").then(response => {
        // 意见类型
        this.opinionTypeOption = response.data
      });
    },
    methods: {
      selectBlur(e) {
        // 意见类型
        if (e.target.value !== '') {
          this.officeInputData.opinionType = ''
          this.officeInputData.opinionType = e.target.value + '(其他)';
          this.$forceUpdate()
        }
        this.handleCompare()
      },
      /**  获取财政数据 获取事务所录入数据 */
      async getData(businessId){
        const res = await getCompareData(businessId);
        if(res.msg && res.msg == "无权限"){
          this.$message({
            message: "无权限!",
            type: 'error'
          });
          this.$router.push("/assurance/list")
        }else {
          this.officeInputData = res.data.officeInput;
          this.financeImportData = res.data.financeImport;
          if (!this.financeImportData.assuranceBusinessDataRegisterSignatures) {
            this.financeImportData.assuranceBusinessDataRegisterSignatures = [{
              "registrationCertificateNo": null,
              "registrantName": null
            }, {"registrationCertificateNo": null, "registrantName": null}]
          } else if (this.financeImportData.assuranceBusinessDataRegisterSignatures.length < 2) {
            this.financeImportData.assuranceBusinessDataRegisterSignatures.push({
              "registrationCertificateNo": null,
              "registrantName": null
            })
          }
          if (!this.officeInputData.assuranceBusinessDataRegisterSignatures) {
            this.officeInputData.assuranceBusinessDataRegisterSignatures = [{
              "registrationCertificateNo": null,
              "registrantName": null
            }, {"registrationCertificateNo": null, "registrantName": null}]
          } else if (this.officeInputData.assuranceBusinessDataRegisterSignatures.length < 2) {
            this.officeInputData.assuranceBusinessDataRegisterSignatures.push({
              "registrationCertificateNo": null,
              "registrantName": null
            })
          }
          // if (this.financeImportData.reportType == "验资业务") {
          //   this.compareFields = ["firmName", "administrativeDivision", "hasSecurities", "customerName", "reportType",
          //      "reportNo", "chargeAmount", "isSecuritiesBusiness", "reportTime", "capitalVerificationAmount", "capitalVerificationCurrency"]
          // } else  if(this.financeImportData.reportType == "验资业务" || this.financeImportData.reportType == "专项审计业务" || this.financeImportData.reportType == "其他"){
          //   this.compareFields = ["firmName", "administrativeDivision", "hasSecurities", "customerName", "reportType",
          //     "reportNo", "chargeAmount", "isSecuritiesBusiness", "reportTime"]
          // } else {
          //   this.compareFields = ["firmName", "administrativeDivision", "hasSecurities", "customerName", "reportType",
          //     "auditYear", "reportNo", "chargeAmount", "isSecuritiesBusiness", "opinionType", "reportTime"]
          // }
          let self = this
          setTimeout(function () {
            self.handleCompare() // 等数据出来后 比对结果
          }, 500)
        }
      },
      /**  数据比对： 财政数据 和 事务所录入数据  操作 */
      handleCompare() {
        this.compareFields.forEach(item => {
          let element = $("label[for="+ item +"]").parent('.el-form-item') // 通过label给父元素加标记
          $("label[for="+ item +"]").addClass('requiredMark') // 必填 * 样式
          if(item=='firstBusinessTime'){
            console.log(this.financeImportData[item]);
            console.log(this.officeInputData[item]);
          }

          if(( (this.financeImportData[item] == null &&  this.officeInputData[item] =='') || (this.financeImportData[item] == '' &&  this.officeInputData[item] ==null) ||  (this.financeImportData[item] != null && this.officeInputData[item] != null && this.financeImportData[item].trim() == this.officeInputData[item].trim()))){
            this.resultData[item] = true // 记录结果
            element.removeClass('compareMark')  // 相等 去掉标红
          }else{
            this.resultData[item] = false
            element.addClass('compareMark') // 标红样式
          }
        })
        if(this.financeImportData.assuranceBusinessDataRegisterSignatures && this.financeImportData.assuranceBusinessDataRegisterSignatures.length>0){
          this.financeImportData.assuranceBusinessDataRegisterSignatures.forEach((item,index) => {
            let labelForNo = 'assuranceBusinessDataRegisterSignatures.' + index + '.registrationCertificateNo'
            let labelForName = 'assuranceBusinessDataRegisterSignatures.' + index + '.registrantName'
            let elementNo = $("label[for='"+labelForNo+"']").parent('.el-form-item') // 通过label给父元素加标记
            let elementName = $("label[for='"+labelForName+"']").parent('.el-form-item') // 通过label给父元素加标记
            if((this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo == this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo) || (this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo == null && this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo == '') || (this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo == '' && this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrationCertificateNo == null)){
              this.resultNoData = true
              elementNo.removeClass('compareMark')  // 相等 去掉标红
            }else{
              this.resultNoData = false
              elementNo.addClass('compareMark') // 标红样式
            }
            if((this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrantName == this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrantName)|| (this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrantName == null &&  this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrantName =='') || (this.financeImportData.assuranceBusinessDataRegisterSignatures[index].registrantName == '' &&  this.officeInputData.assuranceBusinessDataRegisterSignatures[index].registrantName == null )){
              this.resultNoData = true
              elementName.removeClass('compareMark')  // 相等 去掉标红
            }else{
              this.resultNoData = false
              elementName.addClass('compareMark') // 标红样式
            }
          })
        }
        this.saveDisabled = !(Object.values(this.resultData).every(item => item === true) && this.resultNoData === true) // 保存按钮是否可点击
      },
     /* /!**  申请财政数据退回 按钮操作 *!/
      handleReturnFinancialData() {
        this.$confirm('确定申请财政系统数据退回吗？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // 调接口
          this.$message({
            type: 'success',
            message: '操作成功!'
          });
        })
      },*/
      handleOpenReturn() {
        this.returnVisible = true;
        this.returnForm = {
          businessId: this.businessId,
          reason: ''
        }
      },
      handleSubmitReturn() {
        this.returnVisible = false;
        putReturn(this.returnForm).then(res => {
          if (200 === res.code) {
            this.$message({
              type: 'success',
              message: '申请退回成功！'
            });nm
          } else {
            this.$message({
              type: 'info',
              message: '申请退回失败！'
            });
          }
        })
      },
      handleCancelReturn() {
        this.returnVisible = false
      },
      /**  关闭 按钮操作 */
      handleClosePage() {
        this.$router.go(-1)
      },
      /**  保存 按钮操作 */
      handleSaveOfficeInputData() {
        this.$confirm('确定保存事务所防伪系统录入数据吗？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // 调接口
          this.officeInputData.status = 1
          editAssurance(this.officeInputData).then(
            response => {
              this.$confirm('保存成功', '提示', {
                confirmButtonText: '返回',
                showClose: false,
                showCancelButton: false,
                type: 'success'
              }).then(() => {
                this.$router.go(-1)
              });
            }
          ).catch(()=>{

          });
        })
      }
    }
  };
</script>
<style lang="scss" scoped>
  .title{
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 900;
    text-align: center;
  }
  .compareForm{
    width: 400px;
    margin: 0 auto
  }
  .compareMark{
    ::v-deep .el-input__inner,
    ::v-deep .el-textarea__inner
    {
      border-color: red !important;
    }
  }
  ::v-deep .el-input.is-disabled .el-input__inner,
  ::v-deep .el-textarea.is-disabled .el-textarea__inner{
    background-color: #fff;
    border-color: #dfe4ed;
    color: #606266;
    cursor: not-allowed;
  }
  ::v-deep .el-select,
  ::v-deep .el-date-editor.el-input{
    width: 100%;
  }
  .submitBtnGroup{
    margin: 0 auto;
    width: fit-content;
  }
  .requiredMark{
    ::v-deep &:before{
      content: '*' !important;
      color: #ff4949 !important;
      margin-right: 4px !important;
    }
  }
</style>
